#include "EvaluatingFunction.h"  
#include "../RandomProgramming/GeneSet.h"

class VirtualInvertedListTerm;
class Evaluator {	  
	
protected:
	map <double, F<double>* >::const_iterator NextToEvaluate;
	F<double>* evaluateAtPoint( double , const VirtualInvertedListTerm*);
	SemanticEvaluation SimplifiedExpression;
	const Token* XToken;
	GeneSet* Context;

protected:	
	BoundedFunctionPoints* BFP; 
	map <double, F<double>* >::iterator getRandomUnevaluatedPoint( );
	size_t solutionFunctionNumber;
	CEvaluatingFunction* solutionFunction; 	
	void destroy( );
	void destroyBFP( );

public:
	Evaluator( GeneSet* = NULL);
	~Evaluator( );

public:
	CEvaluatingFunction* getSolutionFunction( ){return solutionFunction;};
	void makeSolutionFunction(double=-1.0f, double=1.0f,  size_t = 0, size_t = 100);
	void setContext(GeneSet* GS);
	double evaluateCDNAPopulationMember(const VirtualInvertedListTerm*, time_t, vector<double>) ;	
    void draw( );
};